<!--
 * @Description: csdn文章页面
 * @Author: ZhangHan
 * @Date: 2025-08-26 15:42:29
 * @LastEditTime: 2025-08-27 09:05:11
 * @LastEditors: ZhangHan
-->
<template>
  <web-view
    :webview-styles="webviewStyles"
    @load="load"
    @error="error"
    :src="sourceUrl"
  ></web-view>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { onShow } from "@dcloudio/uni-app";
import { getCurrentRouteParams } from "@/utils/common";

const sourceUrl = ref();

const urlList = [
  "https://blog.csdn.net/a3212768093/article/details/147493106?fromshare=blogdetail&sharetype=blogdetail&sharerId=147493106&sharerefer=PC&sharesource=a3212768093&sharefrom=from_link",
  "https://blog.csdn.net/a3212768093/article/details/142670519?fromshare=blogdetail&sharetype=blogdetail&sharerId=142670519&sharerefer=PC&sharesource=a3212768093&sharefrom=from_link",
  "https://blog.csdn.net/a3212768093/article/details/139040955?fromshare=blogdetail&sharetype=blogdetail&sharerId=139040955&sharerefer=PC&sharesource=a3212768093&sharefrom=from_link",
];

onShow(() => {
  const options = getCurrentRouteParams();
  sourceUrl.value = urlList[options.type];
});

const load = () => {
  console.log("load");
};

const error = () => {
  console.log("error");
};

const webviewStyles = {
  progress: {
    color: "#FF3333",
  },
};
</script>
